package com.dingreading.cloud.admin.service;

import com.dingreading.cloud.admin.dto.StaffDto;
import com.dingreading.cloud.admin.entity.Staff;
import com.dingreading.cloud.common.base.R;
import com.dingreading.cloud.common.util.PageDto;
import com.dingreading.cloud.common.util.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 服务层。
 *
 * @author Administrator
 * @since 2023-11-22
 */
public interface StaffService extends IService<Staff> {

    // 获取所有门店的店长
    PageDto<StaffDto> storeManagerPageList(PageUtil pageUtil, String keyword);

    Staff getByUid(String uid);

    /**
     * 批量修改状态
     */
    boolean updateEnabled(String headStaffUid, String headStaffName, String uid, Integer enabled);

    Staff getLastUsername(String corpUid);

    // 获取门店的员工
    List<StaffDto> getStoreStaffs(String storeUid, String keyword, Integer enabled);

    int dropBean(String staffUid);

    // 重置密码
    boolean resetPwd(String headStaffUid, String headStaffName, String staffUid, String encodedPwd, String pwdSalt);

    boolean updateInfo(String headStaffUid, String headStaffName, String uid, String fullName, String nickName, String pubPhone, String priPhone, String subjectType);

    List<StaffDto> getStoreManager(String keyword);

    Page<Staff> pageList(PageUtil pageUtil, Long storeId, Integer enabled, Integer role, String fullName, String pubPhone, String department);

    List<Staff> getByUids(List<String> uidList);

    // 根据签单人姓名，获取签单人信息
    List<Staff> listByCorpUidAndSaleNameIn(List<String> corpUidList, Set<String> saleNameList);

    boolean updateEnabledByStoreUid(String storeUid, Integer enabled);

    // 查询最后一次登录记录
    Map<String, String> lastLoginTimeLog(List<String> corpUidList);

    R<Object> pageList(PageUtil pageUtil, String storeUid, String keyword, Integer enabled);

    // 更新员工信息和角色信息
    R<Object> editStaffAndRole(
            String headStaffUid, String headStaffName, String storeUid, String staffUid,
            String fullName, String nickName, String pubPhone, String priPhone, String subjectType,
            String roleName, List<Integer> roleList, Integer isHeadquarterStaff, Integer isStoreStaff, Integer inStoreService
    );

}
